<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>文件上传</title>
    <style>
        #preview {
            filter: contrast(7);
        }
    </style>
</head>

<body>
    <form id="uploadForm">
        <input type="file" id="fileInput" name="file">
        <button type="submit">上传</button>
    </form>
</body>

</html>
<script>
    document.getElementById('uploadForm').addEventListener('submit', function (e) {
        e.preventDefault();
        var fileInput = document.getElementById('fileInput');
        var file = fileInput.files[0];
        var formData = new FormData();
        formData.append('file', file);
        var xhr = new XMLHttpRequest();
        xhr.open('POST', 'http://localhost:8081/excel/import', true);
        xhr.onload = function () {
            // 处理上传完成后的响应
        };
        xhr.send(formData);
    });
</script>